package com.example.zhuyu.basemvp.http;

public class BaseResponse<R> {

    private String msg;

    private int code;
    private R data;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public R getData() {
        return data;
    }

    public void setData(R data) {
        this.data = data;
    }

    /**
     * 数据成功
     *
     * @return
     */
    public boolean isSucceeded() {
        return code == 200;
    }

    /**
     * 验证token
     * @return true为有效,false为失效.需发送广播
     */
    public boolean isToken() {
        return code ==0201;
    }
}
